const fs = require('fs');
function home(res) {
    res.writeHead(200, { 'content-type': 'text/html' });
    fs.createReadStream(__dirname + '/home.html').pipe(res);
}

function api(res, params) {
    res.writeHead(200, { 'content-type': 'text/json; charset=utf-8' });
    res.write(JSON.stringify(params));
    res.end();
}

function part(res) {
    res.writeHead(200, { 'content-type': 'text/html' });
    fs.createReadStream(__dirname + '/part.html').pipe(res);
}
function other(res) {
    res.writeHead(200, { 'content-type': 'text/html' });
    fs.createReadStream(__dirname + '/404.html').pipe(res);
}

module.exports = {
    home: home,
    api: api,
    part: part,
    other: other
};
